home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Nov. 96
- // Author: hmbw
- //
- // Description:
- // This script creates a window that can be used to
- // set the keyable status of attributes on active objects.
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
- //
-
- global proc PSupdateKeyableUI ( string $parent, string $selectedItem )
- //
- // Setup the two lists of attributes - those that
- // are keyable, and those that aren't, so the user
- // can flip them from one side to the other.
- //
- {
- setParent $parent;
-
- int $KEYABLE_List_Limit, $NONKEYABLE_List_Limit;
- string $KEYABLE_List[], $NONKEYABLE_List[];
-
- $KEYABLE_List = `listAttr -k -s -v -r -w -c -m $selectedItem`;
- $NONKEYABLE_List = `listAttr -s -v -r -w -c -m $selectedItem`;
- $KEYABLE_List_Limit = size( $KEYABLE_List );
- $NONKEYABLE_List_Limit = size( $NONKEYABLE_List );
-
- $KEYABLE_List = sort($KEYABLE_List);
- $NONKEYABLE_List = sort($NONKEYABLE_List);
-
- // Since listAttr is going to return the full attribute names
- // we need, strip off any component parts of $selectedItem
- // by tokenizing based on the "." character.
- //
- string $node, $buffer[];
- tokenize( $selectedItem, ".", $buffer );
- if( size( $buffer ) > 0 ) {
- $node = $buffer[0];
- } else {
- $node = $selectedItem;
- }
-
- // First clear, then refill the keyable and
- // non-keyable scroll lists
- //
-
- textScrollList -e -m 0 KEYABLE_List;
- textScrollList -e -m 0 NONKEYABLE_List;
-
- textScrollList -e -ra KEYABLE_List;
- textScrollList -e -ra NONKEYABLE_List;
-
- int $i;
- for ( $i=0; $i < $KEYABLE_List_Limit; $i++ )
- {
- textScrollList -e -a $KEYABLE_List[$i] KEYABLE_List;
- }
-
- for ( $i=0; $i < $NONKEYABLE_List_Limit; $i++ )
- {
- int $isKeyable;
- string $attrName = ( $node + "." + $NONKEYABLE_List[$i] );
-
- if( !catch( $isKeyable = `getAttr -k $attrName` )
- &&( $isKeyable == 0 ) )
- {
- textScrollList -e -a $NONKEYABLE_List[$i] NONKEYABLE_List;
- }
- }
-
- textScrollList -e -m 1 KEYABLE_List;
- textScrollList -e -m 1 NONKEYABLE_List;
-
- // Hook up the buttons to the right object
- //
- button -e
- -c ( "PS_moveToNonKeyable " + $parent + " " + $selectedItem )
- NONKEYABLE_Button;
- button -e
- -c ( "PS_moveToKeyable " + $parent + " " + $selectedItem )
- KEYABLE_Button;
-
- // Dim the lock and unlock buttons. They will be undimmed when
- // the user clicks on either list
- //
- disable KEYABLE_Button;
- disable NONKEYABLE_Button;
- }
- /*
- global proc addSorted(string $item, string $list)
- {
- int $numItems = `textScrollList -q -ni $list`;
- string $items[] = `textScrollList -q -ai $list`;
- int $i;
- int $successfull =0;
-
- if ($numItems == 0) {
- textScrollList -e -a $item $list;
- $successfull=1;
- }
-
- for ($i = 0; $i < $numItems; $i++) {
- if (strLess($item,$items[$i])) {
- textScrollList -e -ap ($i+1) $item $list;
- $successfull = 1;
- break;
- }
- }
- if (!$successfull)
- textScrollList -e -a $item $list;
- }
- */
-
- global proc PS_moveToKeyable ( string $parent, string $selectedItem )
- //
- // Move items selected in the non-keyable list
- // to the keyable list...
- //
- {
- setParent $parent;
-
- int $selectedAttrsSize;
- string $selectedAttrs[];
-
- $selectedAttrs = `textScrollList -q -si NONKEYABLE_List`;
- $selectedAttrsSize = size( $selectedAttrs );
-
- // Since listAttr is going to return the full attribute names
- // we need, strip off any component parts of $selectedItem
- // by tokenizing based on the "." character.
- //
- string $node, $buffer[];
- tokenize( $selectedItem, ".", $buffer );
- if( size( $buffer ) > 0 ) {
- $node = $buffer[0];
- } else {
- $node = $selectedItem;
- }
-
- // see if the ALL option is engaged
- //
- int $changeAll = `checkBox -q -v CC_KEYALL_Box`;
-
- if ( $changeAll ){
- // get the node type of the current node
- //
- string $baseType = `nodeType $selectedItem`;
-
- // get a list of all selected nodes
- //
- string $allNodes[] = `selectedNodes`;
-
- // for each node that matches type, set the keyability
- // of each attribute in the non-keyable list
- //
- int $limit = `size($allNodes)`;
- string $thisNode;
- int $index;
- for ( $index=0; $index<$limit; $index++ ){
- $thisNode = $allNodes[$index];
- if ( `nodeType $thisNode` == $baseType ){
- int $i;
- for ( $i=0; $i<$selectedAttrsSize; $i++ ){
- setAttr -k on ( $thisNode + "." + $selectedAttrs[$i] );
- }
- }
- }
- } else { // only change the selected node
-
- int $i;
- for( $i=0; $i < $selectedAttrsSize; $i++ )
- {
- setAttr -k on ( $node + "." + $selectedAttrs[$i] );
- }
- }
-
- // Update the window
- //
- PSupdateKeyableUI $parent $selectedItem;
- }
-
-
- global proc PS_moveToNonKeyable ( string $parent, string $selectedItem )
- //
- // Move items selected in the keyable list
- // to the non-keyable list...
- //
- {
- setParent $parent;
-
- int $selectedAttrsSize;
- string $selectedAttrs[];
-
- $selectedAttrs = `textScrollList -q -si KEYABLE_List`;
- $selectedAttrsSize = size( $selectedAttrs );
-
- // Since listAttr is going to return the full attribute names
- // we need, strip off any component parts of $selectedItem
- // by tokenizing based on the "." character.
- //
- string $node, $buffer[];
- tokenize( $selectedItem, ".", $buffer );
- if( size( $buffer ) > 0 ) {
- $node = $buffer[0];
- } else {
- $node = $selectedItem;
- }
-
- // see if the ALL option is engaged
- //
- int $changeAll = `checkBox -q -v CC_KEYALL_Box`;
-
- if ( $changeAll ){
- // get the node type of the current node
- //
- string $baseType = `nodeType $selectedItem`;
-
- // get a list of all selected nodes
- //
- string $allNodes[] = `selectedNodes`;
-
- // for each node that matches type, set the keyability
- // of each attribute in the non-keyable list
- //
- int $limit = `size($allNodes)`;
- string $thisNode;
- int $index;
- for ( $index=0; $index<$limit; $index++ ){
- $thisNode = $allNodes[$index];
- if ( `nodeType $thisNode` == $baseType ){
- int $i;
- for ( $i=0; $i<$selectedAttrsSize; $i++ ){
- setAttr -k off ( $thisNode + "." + $selectedAttrs[$i] );
- }
- }
- }
- } else { // only change the selected node
- int $i;
- for( $i=0; $i < $selectedAttrsSize; $i++ )
- {
- setAttr -k off ( $node + "." + $selectedAttrs[$i] );
- }
- }
-
- // Update the window
- //
- PSupdateKeyableUI $parent $selectedItem;
- }
-
-
- global proc PScreateKeyableUI( string $parent, string $node )
- //
- // Sets up a UI that shows all the DAG and
- // Shape nodes in the system, so that the
- // user can set the keyable attributes for
- // them.
- //
- {
- setParent $parent;
-
- string $myContainer = `formLayout containerForm`;
-
- text -l "Keyable" KEYABLE_Text;
-
- // Label the non-keyable area
- //
- text -l "Non Keyable" NONKEYABLE_Text;
-
- // Create the Move to non-keyable button
- //
- string $nkButton = `button -l "Move >>"
- -c ( "PS_moveToNonKeyable " + $parent + " " + $node )
- -h 26
- NONKEYABLE_Button`;
-
- // Create the Move to keyable button
- //
- string $kButton = `button -l "<< Move"
- -c ( "PS_moveToKeyable " + $parent + " " + $node )
- -h 26
- KEYABLE_Button`;
-
- // Create the cancel/close button
- //
- button -l "Close" -h 26 -c "deleteUI LockingKeyable" CLOSE_Button;
-
- // Create the ALL checkbox
- //
- if ( !`optionVar -exists CCkeyAllSame` ){
- optionVar -intValue CCkeyAllSame 1;
- }
- checkBox
- -l "Change all selected objects of the same type"
- -v `optionVar -q CCkeyAllSame`
- -cc "optionVar -intValue CCkeyAllSame #1"
- CC_KEYALL_Box;
-
- // Create the keyable scroll list
- //
- textScrollList
- -ams 1
- -h 150
- -sc ("disable KEYABLE_Button; disable -v false " + $nkButton + ";textScrollList -e -da NONKEYABLE_List" )
- KEYABLE_List;
-
- // Create the non-keyable scroll list
- //
- textScrollList
- -ams 1
- -h 150
- -sc ("disable NONKEYABLE_Button; disable -v false " + $kButton + ";textScrollList -e -da KEYABLE_List" )
- NONKEYABLE_List;
-
- separator -style "in" -hr true KEYABLE_Sep;
-
- // Edit the form attachments
- //
-
- formLayout -edit
- -af KEYABLE_Text top 10
- -af KEYABLE_Text left 10
- -ap KEYABLE_Text right 10 50
- -an KEYABLE_Text bottom
-
- -af NONKEYABLE_Text top 10
- -ap NONKEYABLE_Text left 10 50
- -af NONKEYABLE_Text right 10
- -an NONKEYABLE_Text bottom
-
- -af KEYABLE_List top 30
- -af KEYABLE_List left 10
- -ap KEYABLE_List right 0 50
- -ac KEYABLE_List bottom 10 KEYABLE_Sep
-
- -af NONKEYABLE_List top 30
- -ap NONKEYABLE_List left 0 50
- -af NONKEYABLE_List right 10
- -ac NONKEYABLE_List bottom 10 KEYABLE_Sep
-
- -an KEYABLE_Sep top
- -af KEYABLE_Sep left 0
- -af KEYABLE_Sep right 0
- -af KEYABLE_Sep bottom 60
-
- -an CC_KEYALL_Box top
- -af CC_KEYALL_Box left 15
- -af CC_KEYALL_Box bottom 30
- -an CC_KEYALL_Box right
-
- -ac CLOSE_Button top 2 CC_KEYALL_Box
- -ap CLOSE_Button right 2 66
- -ap CLOSE_Button left 2 33
- -af CLOSE_Button bottom 5
-
- -ac NONKEYABLE_Button top 2 CC_KEYALL_Box
- -ap NONKEYABLE_Button right 2 33
- -af NONKEYABLE_Button left 5
- -af NONKEYABLE_Button bottom 5
-
- -ac KEYABLE_Button top 2 CC_KEYALL_Box
- -ap KEYABLE_Button left 2 66
- -af KEYABLE_Button right 5
- -af KEYABLE_Button bottom 5
-
- $myContainer;
-
-
- // Fill the scroll lists
- // with the selected object's attributes
- //
-
- PSupdateKeyableUI $parent $node;
- showWindow;
- }
-